using System;
using Tick;
using UnityEngine;

public class DoublePressGestureEvent : MonoBehaviour
{
    public bool IsRestrictionSingleFinger;
    public Action<FingerOperationData> OnDoublePressEvent;
    private void OnEnable()
    {
        FingerEventHandle.Current.OnDoublePress += OnDoublePress;
    }
    private void OnDisable()
    {
        if (FingerEventHandle.Current != null)
        FingerEventHandle.Current.OnDoublePress -= OnDoublePress;
    }
    private void OnDoublePress(FingerOperationData data)
    {
        if (IsRestrictionSingleFinger && data.fingerId != 0) return;
        if (data.CheckCurrentDown != gameObject) return;
        OnDoublePressEvent?.Invoke(data);
    }
}
